Used to overload the ^ operator, providing custom functionality.
Syntax |
|---|
Notes
Create an Operator_Power function in a class to specify the functionality of the ^ operator for that class. When you use the ^ operator in your code to operate on two instances of the class, your Operator_Power function will be called.
In the function, the Self instance the left operand and the other operand is passed as a parameter. The Selfinstance is raised to the power specified by the passed instance.
Example
Using the Vector class (see Operator_Add) with two Integer elements, x and y, we define an Operator_Power function that raises the sum of the Self instance to the power of the passed instance.
Function Operator_Power(rhs as Vector) as Integer
Dim a, b as Integer
a= Self.x + Self.y
b=rhs.x + rhs.y
Return a ^b
Dim a, b as Integer
a= Self.x + Self.y
b=rhs.x + rhs.y
Return a ^b
See Also
^ operator; Operator_PowerRight function.